realtek: pcs: rtl838x: refactor imported code
authorJonas Jelonek <[email protected]>
Fri, 7 Nov 2025 11:45:30 +0000 (11:45 +0000)
committerHauke Mehrtens <[email protected]>
Mon, 8 Dec 2025 23:28:34 +0000 (00:28 +0100)
commitb670d4836641b4427b7b7b9d94bb670b0d44c12b
treedadccee33ea192cceee67e2e2f145034e990aecd
parentf4129beb39703b220fdfc270aa55f395714190f5
realtek: pcs: rtl838x: refactor imported code

The previous commit just imported some code as-is and commented it.
It needs heavy adjustments to compile and work within the PCS driver.
Do that now to that extent that it can be used within the driver. More
cosmetics and improvements will be done later.

Split the once-for-all SerDes configuration into the usual flow where
each SerDes is configured separately and on its own, as requested by the
PCS subsystem.

Move mode setting and patching into proper functions which are called
during SerDes configuration. Some configuration sequences are broken up
and moved into the SerDes configuration flow, e.g. reset sequences
because they were usually a single/few values applied to all SerDes at
once before.

Add proper configuration for SerDes 4 QSGMII to be able to setup this
mode properly on our own.

Signed-off-by: Jonas Jelonek <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20876
Signed-off-by: Hauke Mehrtens <[email protected]>
target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c